package com.heima.reggie.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heima.reggie.domain.Category;
import com.heima.reggie.service.CategoryService;
import com.heima.reggie.mapper.CategoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author liulanhui
* @description 针对表【category(菜品及套餐分类)】的数据库操作Service实现
* @createDate 2023-01-02 16:54:00
*/
@Service
public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category>
    implements CategoryService{
    @Autowired
    CategoryMapper categoryMapper;

    @Override
    public List<Category> selectAllByType(Integer type) {
        List<Category> categories = categoryMapper.selectAllByType(type);
        return categories;
    }

    @Override
    public String getCategoryNameById(Long categoryId) {
        Category category = categoryMapper.selectById(categoryId);
        String name = category.getName();
        return name;
    }
}




